package com.seal.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.seal.comm.utils.Page;
import com.seal.dao.IGroupMemberDao;
import com.seal.dto.GroupMemberDto;
import com.seal.model.GroupMember;
import com.seal.model.MemberInfo;
import com.seal.service.IGroupMemberService;

@Service("groupMemberServiceImpl")
@Transactional(readOnly = true)
public class GroupMemberServiceImpl implements IGroupMemberService {
	
	@Resource(name = "groupMemberDaoImpl")
	private IGroupMemberDao groupMemberDao;

	@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackForClassName = "Exception")
	public void addGroupMember(GroupMember ca) throws Exception {
		groupMemberDao.addGroupMember(ca);
	}

	@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackForClassName = "Exception")
	public void deleteGroupMember(GroupMember ca) throws Exception {
		groupMemberDao.deleteGroupMember(ca);
	}

	public List<MemberInfo> getAllGroupMember(GroupMemberDto groupMemberDto, Page page) throws Exception {
		return groupMemberDao.getAllGroupMember(groupMemberDto, page);
	}

	@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackForClassName = "Exception")
	public void updateGroupMembers(List<GroupMember> list, Long groupId) throws Exception {
		groupMemberDao.updateGroupMembers(list, groupId);
	}

	public List<GroupMember> getGroupMemberByGroupId(Long groupId)
			throws Exception {
		return groupMemberDao.getGroupMemberByGroupId(groupId);
	}
}
